package com.rc.saas.tenant.shiro;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListenerAdapter;

/**
 * shiro session监听器
 * Created by Sven on 2021/10/22
 */
public class CustomSessionListenerAdapter extends SessionListenerAdapter {
    private static Logger logger = LogManager.getLogger(CustomSessionListenerAdapter.class);

    /**
     * 会话创建时触发
     * @param session
     */
    @Override
    public void onStart(Session session) {
        logger.info("会话创建:{}", session.getId());
    }

    /**
     * 会话过期时触发
     * @param session
     */
    @Override
    public void onExpiration(Session session) {
        logger.info("会话过期:{}", session.getId());
    }

    /**
     * 退出时触发
     * @param session
     */
    @Override
    public void onStop(Session session) {
        logger.info("会话停止:{}", session.getId());
    }
}
